

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'dict-battery-form',
	'enableAjaxValidation'=>false,
	'htmlOptions'=>array(
		'class' => 'form collapsed dict_battery',
	),
)); ?>
<fieldset class="grey inline">
	<legend><?php echo Controller::getActionName($this->action->id); ?></legend>
	
	<div class="notification tip" style="display: block; "> 
    <span class="strong">Tip:</span> <?php echo $form->errorSummary($model); ?>
 <span class="close" title="Dismiss"></span>
    </div>

	<div class = "row">
	<label>
		<?php echo $form->labelEx($manumodel,'MANNAME_V'); ?>
		
		<select name="DictManufacturer[RECORD_ID]"> 
		<?php foreach($manufacturer as $man){?>
		<option <?php echo ($model->MANCODE_V == $man->RECORD_ID)?'selected="selected"':'';?>value="<?php echo $man->RECORD_ID;?>"><?php echo $man->MANNAME_V;?>
	    <?php } ?>
		</option>		
		</select>
		
		<?php // echo CHtml::dropDownList('DictManufacturer[RECORD_ID]','', CHtml::listData($manufacturer, 'RECORD_ID', 'MANNAME_V'),array('options' => array('2'=>array('selected'=>true))));	
		?>
		<?php //echo $form->error($model,'BASE_N'); ?>
	</label>
	</div>
	
	<div class = "row">
	<label>
		<?php echo $form->labelEx($btsortmodel,'SORTNAME_V'); ?>
		<select name="DictBatterySort[RECORD_ID]"> 
		<?php foreach($batterysort as $bt){?>
		<option <?php echo ($model->BATTERYSORT_V == $bt->RECORD_ID)?'selected="selected"':'';?>value="<?php echo $bt->RECORD_ID;?>"><?php echo $bt->SORTNAME_V;?>
	    <?php } ?>
		</option>		
		</select>
		
		<?php // echo CHtml::dropDownList('DictBatterySort[RECORD_ID]','', CHtml::listData($batterysort, 'RECORD_ID', 'SORTNAME_V'));
		?>
		<?php //echo $form->error($model,'BASE_N'); ?>
	</label>
	</div>

	<div class = "row">
	<label>
		<?php echo $form->labelEx($model,'BATTERYTYPE_V'); ?>
		<?php echo $form->textField($model,'BATTERYTYPE_V',array('size'=>50,'maxlength'=>50)); ?>
		<?php //echo $form->error($model,'BATTERYTYPE_V'); ?>
	</label>
	</div>
	
	<div class = "row">
	<label>
		<?php //echo $form->labelEx($model,'CREATE_DATE'); ?>
		<?php //echo $form->textField($model,'CREATE_DATE'); ?>
		<?php //echo $form->error($model,'CREATE_DATE'); ?>
	</label>
	</div>
	
	<div class = "row">
	<label>
		<?php echo $form->labelEx($model,'VOLTAGE_V'); ?>
		<?php echo $form->textField($model,'VOLTAGE_V',array('size'=>50,'maxlength'=>50)); ?>
		<?php //echo $form->error($model,'VOLTAGE_V'); ?>
	</label>
	</div>


	<div class = "row">
	<label>
		<?php echo $form->labelEx($model,'CHARGEVOL_V'); ?>
		<?php echo $form->textField($model,'CHARGEVOL_V',array('size'=>50,'maxlength'=>50)); ?>
		<?php //echo $form->error($model,'CHARGEVOL_V'); ?>
	</label>
	</div>
	<div class = "row">
	<?php 

	?>	
	</div>
	
	<div class = "row">
	<label>
		<?php echo $form->labelEx($model,'STDVOLUME_V'); ?>
		<?php echo $form->textField($model,'STDVOLUME_V',array('size'=>50,'maxlength'=>50)); ?>
		<?php //echo $form->error($model,'STDVOLUME_V'); ?>
	</label>
	</div>
	
	<div class = "row">

		<label>预估容量计算公式</label>
		Y = (B0)<?php echo $form->textField($model,'B0',array('size'=>10,'maxlength'=>10)); ?> + (B1)<?php echo $form->textField($model,'B1',array('size'=>10,'maxlength'=>10,'for'=>'DictBattery_B1')); ?>*x
		<?php 
		$id = $model->RECORD_ID;
		echo CHtml::ajaxButton('清除历史数据', array('DictBattery/clean&id='.$id.''), array(
				"dataType" => 'json',
				"success" => 'js:function(rs){
			if(rs.no == 0){
				alert("清除历史数据成功");
			}else{
				alert("清除历史数据失败");
			}
		}'),array('class'=>'button blue inline','style'=>'width:100px;'));		
		echo CHtml::ajaxButton('重新计算', array('DictBattery/recompute&id='.$id.''), array(
		"dataType" => 'json',
		"success" => 'js:function(rs){
			if(rs.no == 0){
				$("#DictBattery_B0").val(rs.data.b0);
				$("#DictBattery_B1").val(rs.data.b1);	
		}}'),array('class'=>'button blue inline','style'=>'width:100px;'));
//		echo CHtml::button('下载模版', array('submit' => array('DictBattery/download'))); 
		echo CHtml::link('导入实验数据', 'javascript:void(0);', array(
			'onclick'=>'window.openImport("DictBattery/upload&id='.$id.'");',
		));
		 ?>
		<a href=""></a>

	</div>
	
	<div class = "row">
	<label>
		<?php echo $form->labelEx($model,'ISINNER'); ?>
		<?php echo $form->textField($model,'ISINNER',array('size'=>50,'maxlength'=>50,'value'=>'标称内阻','readonly'=>true)); ?>
		<?php //echo $form->error($model,'STDINNER_V'); ?>
	</label>
	</div>
	
	
	<div class = "row">
	<label>
		<?php echo $form->labelEx($model,'STDINNER_V'); ?>
		<?php //echo $form->textField($model,'STDINNER_V',array('size'=>50,'maxlength'=>50,'onkeyup'=>'$("#DictBattery_YELLOWVALUE_N").val((this.value*1.2));$("#DictBattery_REDVALUE_N").val(this.value*1.4)')); ?>
		<?php echo $form->textField($model,'STDINNER_V',array('size'=>50,'maxlength'=>50,'onchange'=>'$("#DictBattery_YELLOWVALUE_N").val(((this.value*1.2 + "" ).match(/[0-9]+.[0-9]{0,4}/)));$("#DictBattery_REDVALUE_N").val(((this.value*1.4 + "" ).match(/[0-9]+.[0-9]{0,4}/)))')); ?>
		<?php //echo $form->error($model,'STDINNER_V'); ?>
	</label>
	</div>
		
	<div class = "row">
	<label>
		<?php echo $form->labelEx($model,'YELLOWVALUE_N'); ?>
		<?php echo $form->textField($model,'YELLOWVALUE_N',array('size'=>10,'maxlength'=>10)); ?>
		<?php //echo $form->error($model,'YELLOWVALUE_N'); ?>
	</label>
	</div>
	<div class = "row">
	<label>
		<?php echo $form->labelEx($model,'REDVALUE_N'); ?>
		<?php echo $form->textField($model,'REDVALUE_N',array('size'=>10,'maxlength'=>10)); ?>
		<?php //echo $form->error($model,'REDVALUE_N'); ?>
	</label>
	</div>
	<div class = "row">
	<label>
		<?php echo $form->labelEx($model,'REMARK_V'); ?>
		<?php echo $form->textField($model,'REMARK_V',array('size'=>60,'maxlength'=>255)); ?>
		<?php //echo $form->error($model,'REMARK_V'); ?>
	</label>
	</div>

	<?php echo CHtml::endForm(); ?>

	<?php echo CHtml::submitButton('保存',array('class'=>'button blue')); ?>
</fieldset>
<?php $this->endWidget(); ?>

<?php 
$this->beginWidget('zii.widgets.jui.CJuiDialog', array(
    'id'=>'import_dialog',
    'options'=>array(
        'title'=>'导入实验数据',
        'autoOpen'=>false,
    ),
));
$this->endWidget('zii.widgets.jui.CJuiDialog');
?>
<script>
function openImport(link){
	$("#import_dialog").html('<iframe src="index.php?r='+ link +'" width="100%" scrolling="no" frameborder="0" height="340"></iframe>');
	$("#import_dialog").dialog({positon:['center','top'],width:'50%',height:'auto',minHeight:300}); 
	$("#import_dialog").dialog("open")
	return false;	
}
</script>